import request from '../../utils/request'

export function requestSellTotal () {
    return new Promise(resolve => {
        request.get('/statistic/user/sales').then(res => {
            resolve(res.data)
        })
    })
}

export function requestUserBack () {
    return new Promise(resolve => {
        request.get('/statistic/user/back').then(res => {
            resolve(res.data)
        })
    })
}

export function requestUserTotal () {
    return new Promise(resolve => {
        request.get('/statistic/user/total').then(res => {
            resolve(res.data)
        })
    })
}

export function requestShopTotal () {
    return new Promise(resolve => {
        request.get('/statistic/pro/total').then(res => {
            resolve(res.data)
        })
    })
}

export function requestShopUnload () {
    return new Promise(resolve => {
        request.get('/statistic/pro/lack').then(res => {
            resolve(res.data)
        })
    })
}

export function requestGoodComments () {
    return new Promise(resolve => {
        request.get('/statistic/comment/good').then(res => {
            resolve(res.data)
        })
    })
}

export function requestChartForSales () {
    return new Promise(resolve => {
        request.get('/statistic/sales').then(res => {
            resolve(res.data)
        })
    })
}

export function requestChartsForClassifySales () {
    return new Promise(resolve => {
        request.get('/statistic/classify').then(res => {
            resolve(res.data)
        })
    })
}

export function requestChartsForUserBuy (userid) {
    return new Promise(resolve => {
        request.get('/statistic/user/buy', {
            params: {
                userid
            }
        }).then(res => {
            resolve(res.data)
        })
    })
}
